----------------------------------------------------------------- Expr.vbx v2.2 Copyright, July 1995, Minxiu Chen, All Rights Reserved ---------------------------------------------------------------- =========== The program =========== Exprs.vbx and Expr.dll parse the text inputed by the user to see if it is a numerical expression. If so, it do infix arithmetic expression parsing. The source code is written in C. It use so called "recursive descent" technique and analysis the text to be set at the property "Strinput". The results will be given at properties "NumValue", "IsNumExpr" and "StrLength." It supports operators: " +, -, *, /, %, ^ " and functions: " sin, cos, tan, ctg or ctn, asin, acos, atg, ln, lg or log10, exp, abs, sqrt, sqrt3, fix, rand or rnd." and constants: "pi or Pi, e" All these functions are self-explanatory, sqrt3(8) --> 2 rand(10) --> a random value between 0 and 10 11%4 --> 3 15.2%4.2 --> 2.6 230 could be written as 2.3E2 3^3 -->27 (123 + sin(pi/2)) * 4^5* ln(exp(56))%11->3 a=2, b=1.5*a, a^b --> 8 'Expvbx version 2' support variable name substitution. variable must start with alphebet. all varibles that have not been assigned any values are considered as zeros. It supports following string manipulation functions: lcase(string) convert a string to low case ucase(string) convert a string to upper case cat(string1,string2) returns concatenated string rtrim(string, num) returns rightmost num characters of a string ltrim(string, num) returns leftmost num characters of a string len(string) find length of a string string(string,num) returns a string whose num characters are all the first character of a string You may try run expr.exe, type an expression to the box then press either 'call Expr.vbx' button or 'test dll file' button: expression --> value a=123 --> 123 b=a*0.4 --> 49.2 c= 2*a +sin(b) --> 245.125 ln(a)+ln(c) --> 10.31395 a=123,b=4,c=5,d=56,e=11,a+sin(pi/2) * b^c * ln(exp(d))%e-->3 abcde=23 --> 23 cat(lcase(ABc),rtrim(dee,2))--> 23 A demo VB code are also included. If the user don't have vbrun300.dll in his/her window/system directory, he/she should download vbrun300.dll from SimTel, CICA or other sites and put in same directory as expr.exe or search path to run the expr.exe. Functions provided by expr.dll: float _export far pascal expres( char FAR *S) int far pascal chkexpr(char FAR *S) The declare statement for VB: Declare Function chkexpr Lib "expr.dll" (ByVal S As String) As Integer Declare Function expres Lib "expr.dll" (ByVal S As String) As Double unregistered version only support 6 variable name substitutions. After using 6 variables if you want to use other variables, you have to unload the dll file or restart window. ============ Registration Registration ============ The program EXPR.VBX is distributed as a shareware program. You have the right to test this program for 10 days. You are allowed to copy this unregistered package and give it to any other person, as long as it is not modified in any way. After the trial period, If you find it useful and want to keep using it, You are obliged to register your copy. Unregistered version only support 2 variable name substitutions, registered version do not have such limit. When updated, the registered user may get all newer versions free. This software may NOT be used for commercial purpose without registration. ========== Disclaimer ========== The program has been tested to keep it as bug-free. But I still declare that it is supplied "As is" without warranty of any kind. You use it at your own risk. I accept no responsibility for any damage or loss, physical, financial, or otherwise, that may result from the use. If these terms are not acceptable to you, then you have NO license to use or test EXPR.VBX. You should IMMEDIATELY DELETE it from your disks.